package web.fabrimind.dm.service.impl;

import java.util.List;
import web.fabrimind.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import web.fabrimind.dm.mapper.EquipmentMaintenanceMapper;
import web.fabrimind.dm.domain.EquipmentMaintenance;
import web.fabrimind.dm.service.IEquipmentMaintenanceService;

/**
 * 设备维护记录Service业务层处理
 * 
 * @author zhihui
 * @date 2025-03-25
 */
@Service
public class EquipmentMaintenanceServiceImpl implements IEquipmentMaintenanceService 
{
    @Autowired
    private EquipmentMaintenanceMapper equipmentMaintenanceMapper;

    /**
     * 查询设备维护记录
     * 
     * @param maintenanceId 设备维护记录主键
     * @return 设备维护记录
     */
    @Override
    public EquipmentMaintenance selectEquipmentMaintenanceByMaintenanceId(Long maintenanceId)
    {
        return equipmentMaintenanceMapper.selectEquipmentMaintenanceByMaintenanceId(maintenanceId);
    }

    /**
     * 查询设备维护记录列表
     * 
     * @param equipmentMaintenance 设备维护记录
     * @return 设备维护记录
     */
    @Override
    public List<EquipmentMaintenance> selectEquipmentMaintenanceList(EquipmentMaintenance equipmentMaintenance)
    {
        return equipmentMaintenanceMapper.selectEquipmentMaintenanceList(equipmentMaintenance);
    }

    /**
     * 新增设备维护记录
     * 
     * @param equipmentMaintenance 设备维护记录
     * @return 结果
     */
    @Override
    public int insertEquipmentMaintenance(EquipmentMaintenance equipmentMaintenance)
    {
        equipmentMaintenance.setCreateTime(DateUtils.getNowDate());
        return equipmentMaintenanceMapper.insertEquipmentMaintenance(equipmentMaintenance);
    }

    /**
     * 修改设备维护记录
     * 
     * @param equipmentMaintenance 设备维护记录
     * @return 结果
     */
    @Override
    public int updateEquipmentMaintenance(EquipmentMaintenance equipmentMaintenance)
    {
        equipmentMaintenance.setUpdateTime(DateUtils.getNowDate());
        return equipmentMaintenanceMapper.updateEquipmentMaintenance(equipmentMaintenance);
    }

    /**
     * 批量删除设备维护记录
     * 
     * @param maintenanceIds 需要删除的设备维护记录主键
     * @return 结果
     */
    @Override
    public int deleteEquipmentMaintenanceByMaintenanceIds(Long[] maintenanceIds)
    {
        return equipmentMaintenanceMapper.deleteEquipmentMaintenanceByMaintenanceIds(maintenanceIds);
    }

    /**
     * 删除设备维护记录信息
     * 
     * @param maintenanceId 设备维护记录主键
     * @return 结果
     */
    @Override
    public int deleteEquipmentMaintenanceByMaintenanceId(Long maintenanceId)
    {
        return equipmentMaintenanceMapper.deleteEquipmentMaintenanceByMaintenanceId(maintenanceId);
    }


    /**
     * 查询设备名称列表（不分页）
     */
    @Override
    public List<EquipmentMaintenance> selectEquipmentList(EquipmentMaintenance equipmentMaintenance) {
        return equipmentMaintenanceMapper.selectEquipmentList(equipmentMaintenance);
    }
}
